package com.lovely602.boot.bootdemo.domain.common.exception;

import java.text.MessageFormat;

/**
 * @author lizhixing
 */
public interface ErrorCodes {
  int getCode();

  String getMsg();

  ErrorLevel getErrorLevel();

  default String formatMsg(Object... arguments) {
    if (arguments == null || arguments.length == 0) {
      return getMsg();
    }
    return MessageFormat.format(getMsg(), arguments);
  }
}
